package alva.com.getcamera.view.activity;

import android.content.Intent;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.WindowManager;

import java.util.ArrayList;

import alva.com.getcamera.R;
import alva.com.getcamera.adapter.PhotoViewPagerAdapter;
import alva.com.getcamera.bean.ImageBean;

public class PicActivity extends AppCompatActivity {
    private ViewPager viewPager;
    private ArrayList<ImageBean> imageList;
    private PhotoViewPagerAdapter adapter;
    private int position;
    private static int currentPosition;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().setFormat(PixelFormat.TRANSLUCENT);
        setContentView(R.layout.activity_pic);
        viewPager = (ViewPager) findViewById(R.id.viewpager);
        Intent intent = getIntent();
        position = intent.getIntExtra("position", 0);
        currentPosition=position;
        imageList = intent.getParcelableArrayListExtra("imageList");
        adapter=new PhotoViewPagerAdapter(this,imageList);
        viewPager.setAdapter(adapter);
        viewPager.setCurrentItem(currentPosition,false);
    }
}
